<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./WEB-INF/template.xhtml">

            <ui:define name="pageTitle">
                Lease book
            </ui:define>

            <ui:define name="content">
                <f:view>
                    <h:form>
                        <h1><h:outputText value="Lease book"/></h1>
                        <h:panelGrid columns="3">
                            <h:outputLabel value="Reader:" for="reader" />
                            <h:selectOneMenu id="reader" value="#{leaseBean.l.reader}" title="Reader" required="true"
                                             requiredMessage="The Reader field is required." converter="#{readerConverter}">
                                <f:selectItems value="#{readerBean.readers}"/>
                            </h:selectOneMenu>
                            <h:message for="reader"/>
                            <h:outputLabel value="Exemplar:" for="exemplar" />
                            <h:selectOneMenu id="exemplar" value="#{leaseBean.l.exemplar}" title="Exemplar"
                                             required="true" requiredMessage="The Exemplar field is required."
                                             converter="#{exemplarConverter}">
                                <f:selectItems value="#{exemplarBean.exemplarsByBookAvailable}"/>
                            </h:selectOneMenu>
                            <h:message for="exemplar"/>
                        </h:panelGrid>
                        <h:commandButton action="#{redirect.to('books.xhtml')}"
                                         actionListener="#{leaseBean.create()}"
                                         value="Lease">
                            <f:param name="bid" value="#{param.bid}"/>
                        </h:commandButton>
                    </h:form>
                </f:view>

            </ui:define>

        </ui:composition>

    </body>
</html>
